/**
 * ProtocollPanel.java
 * @author pkendzo
 * Email: pkendzo@msn.com
 * 2010
 */
package lu.med.praxiswahl.wahlumed.client.rechnungen.op.view;

import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import lu.med.praxiswahl.wahlumed.client.utilities.ContextFactoryRemote;
import lu.med.praxiswahl.wahlumed.client.wclient.PatientenSuchmaskeListener;
import lu.med.praxiswahl.wahlumed.model.beans.OPBillsTBL;
import lu.med.praxiswahl.wahlumed.service.beans.serviceinterface.OPBillServiceInt;


public class ProtocollPanel extends JPanel implements BillItemListener, PatientenSuchmaskeListener
{

    /**
     * 
     */
    private static final long serialVersionUID = 5249016789161935389L;
    private JTextArea area;
    private JScrollPane scrollPane;
    private ContextFactoryRemote remote;
    private OPBillServiceInt opBillService;
    
    public ProtocollPanel()
    {
	super(new GridLayout(1,1));
	this.setBorder(BorderFactory.createTitledBorder("Protokoll"));
	
	remote = new ContextFactoryRemote(); 
	opBillService = remote.getRemoteOPBillServiceInt();
	
	
	area = new JTextArea();
	area.setEditable(true);
	this.scrollPane = new JScrollPane(area);
	
	this.add(scrollPane);
    }

    /**
     * @param args
     */
    public static void main(String[] args)
    {
	// TODO Auto-generated method stub

    }
    
    /*
     * Leer die Anzeige des Panels
     */
    public void clearDisplay()
    {
	this.area.setText("");
    }
    

    @Override
    public void modelChangeAppend(long billNumber)
    {
	OPBillsTBL bill = opBillService.retrieveOPBillByID(billNumber);
	
	this.area.setText(bill.getNoten());
	
    }

    @Override
    public void modelChanged(String matricule)
    {
	this.clearDisplay();
	
    }

    /**
     * @return the area
     */
    public JTextArea getArea()
    {
        return area;
    }

    /**
     * @param area the area to set
     */
    public void setArea(JTextArea area)
    {
        this.area = area;
    }

    
}
